<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Embassy_model extends CI_Model{
	
	var	$table				=	"prices";
	var $table_country		=	"country";
	var $table_customers	=	"customers";
	var	$table_apply		=	"apply";
	var $table_embassy		=	"embassy";
	
	function __construct(){
        parent::__construct(); 
    }
    
    function get_country($letter){
    	$country	=	$this->db->select('id,name')
    							 ->where('LEFT(`name`, 1) =', $letter)
    							 ->get($this->table_country)
    							 ->result();
    	return $country;
    }
    
    
    function check_embassy($country_id){
    	$embassy	=	$this->db->where('id_country', $country_id)
    							 ->select('COUNT(*) as tt')
    							 ->get($this->table_embassy)
    							 ->row();
    	return $embassy->tt;
    }
	
    
    function get_country_detail($country_name = ""){
    	$country	=	$this->db->where('name',$country_name)
    						 	 ->get($this->table_country)
    							 ->row_array();
    	return $country; 
    }
    
    function get_embassy_detail($country_id = 0){
    	$embassy	=	$this->db->where('id_country', $country_id)
    							 ->get($this->table_embassy)
    							 ->result();
    	return $embassy;
    	
    }

}
/* End of file embassy_model.php */
/* Location: ./application/models/embassy_model.php */